/*
创建数据模型 和 mongdb的数据表做关联
1. 创建scheme对象
2. 将schema对象转化为数据模型
3. 调用数据模型下的方法操作数据库
*/ 
const mongoose = require("mongoose")

const Schema = mongoose.Schema;
let cartSchema = new Schema({
  name: { type: String, required: true },
  price: { type: String, default: 0 },
  num: { type: Number, default: 0 },
  uid:{ type: String, required: true},
  ctime: { type: Date, default: Date.now },
});

let cartModel = mongoose.model("cart",cartSchema)

module.exports = cartModel
